package com.kaiqingsun.io;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;

public class Demo7 {
    public static void main(String[] args) throws Exception{
        try ( InputStream is = new FileInputStream("./hello.txt")){
            try(Scanner scanner = new Scanner(is,"UTF-8")){
                while (scanner.hasNextLine()){
                    String line =scanner.nextLine();//默认去掉了换行符
                    System.out.println("|"+line+"|");
                }
            }
        }
    }
}
